package bootstrap

import (
	"devops-dcc/internal/pkg/logger"
	"go.uber.org/zap"
)

func InitLogger() error {
	if err := logger.Init(logger.Config{
		Level:      cfg.Logger.Level,
		Filename:   cfg.Logger.Filename,
		MaxSize:    cfg.Logger.MaxSize,
		MaxBackups: cfg.Logger.MaxBackups,
		MaxAge:     cfg.Logger.MaxAge,
		Compress:   cfg.Logger.Compress,
	}); err != nil {
		return err
	}

	globalLogger = logger.Logger
	zap.ReplaceGlobals(globalLogger)
	return nil
}
